package com.lyw.dubbo.serviceImpl;

import com.lyw.dubbo.entity.UserEntity;
import com.lyw.dubbo.service.OrderService;
import com.lyw.dubbo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 1 将服务提供者注册到注册中心
 *      1) 导入dubbo依赖
 *
 * 2 让消费者去注册中心订阅服务者提供的服务地址
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    UserService userService;
    /**
     * 初始化用户订单
     *
     * @param userId
     */
    public void initOrder(Integer userId) {
        System.out.println(userId);
        List<UserEntity> userList = userService.getUserList(userId);
        System.out.println(userList);
        for (UserEntity userEntity :userList){
            System.out.println(userEntity.getAddress());
        }

    }
}
